/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gui.swing;

import gui.listener.PopupMenuTextFieldsListener;
import javax.swing.JSpinner;
import javax.swing.SpinnerNumberModel;
import resources.Messages;

/**
 *
 * @author vinicius
 */
public class DownlodFilesTrash extends javax.swing.JPanel {

    /**
     * Creates new form DownlodFilesTrash
     */
    public DownlodFilesTrash() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jButtonCancelarReenvio = new javax.swing.JButton();
        jButtonReenviar = new javax.swing.JButton();
        jTextFieldDestino = new javax.swing.JTextField();
        jLabelDestino = new javax.swing.JLabel();
        jLabelTempo = new javax.swing.JLabel();
        jSpinnerTempoEntreReenvios = new JSpinner(new SpinnerNumberModel(1, 0, 9999, 1));

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Reenviar"));
        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, Messages.message.getString("forward.title"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, Constantes.unicodeFontPlain));

        jButtonCancelarReenvio.setText("Cancelar Reenvio");
        jButtonCancelarReenvio.setEnabled(false);
        jButtonCancelarReenvio.setText(Messages.message.getString("forward.cancelForwarding"));
        jButtonCancelarReenvio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonCancelarReenvioActionPerformed(evt);
            }
        });

        jButtonReenviar.setText("Reenviar");
        jButtonReenviar.setText(Messages.message.getString("forward.forward"));
        jButtonReenviar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonReenviarActionPerformed(evt);
            }
        });

        jTextFieldDestino.addMouseListener(new PopupMenuTextFieldsListener());

        jLabelDestino.setText("Destino:");
        jLabelDestino.setText(Messages.message.getString("sendEmail.to"));

        jLabelTempo.setText("Tempo Entre Envios:");
        jLabelTempo.setText(Messages.message.getString("geral.tempoEntreReenvio"));

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabelDestino)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTextFieldDestino, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButtonReenviar)
                        .addGap(6, 6, 6)
                        .addComponent(jButtonCancelarReenvio))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabelTempo)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jSpinnerTempoEntreReenvios, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(268, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabelDestino)
                    .addComponent(jTextFieldDestino, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButtonReenviar)
                    .addComponent(jButtonCancelarReenvio))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabelTempo)
                    .addComponent(jSpinnerTempoEntreReenvios, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 730, Short.MAX_VALUE)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addContainerGap()))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 407, Short.MAX_VALUE)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(112, 112, 112)
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(219, Short.MAX_VALUE)))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void jButtonCancelarReenvioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCancelarReenvioActionPerformed
        /*
        if (this.connector instanceof HttpConnectorBaseWithForwarding) {
            HttpConnectorBaseWithForwarding connectorWithForwarding = (HttpConnectorBaseWithForwarding) this.connector;
            connectorWithForwarding.stopForwarding();
        }
        */
    }//GEN-LAST:event_jButtonCancelarReenvioActionPerformed

    private void jButtonReenviarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonReenviarActionPerformed
    /*
        List<Email> mensagensParaReenviar = new ArrayList<Email>();
        for (int i = 0; i < jTableAindaNaoProcessados.getRowCount(); i++) {
            Boolean selecionado = (Boolean) jTableAindaNaoProcessados.getValueAt(i, 0);
            if (selecionado != null && selecionado.booleanValue()) {
                mensagensParaReenviar.add((Email) jTableAindaNaoProcessados.getValueAt(i, 1));
            }
        }
        if (mensagensParaReenviar.size() == 0) {
            MainSystray.guiFactory.getMessageDisplayer().displayErrorMessage(Messages.exception.getString("listaArquivosGUI.escolhaArquivo"));
            return;
        }
        if (jTextFieldDestino.getText().trim().length() == 0) {
            MainSystray.guiFactory.getMessageDisplayer().displayErrorMessage(Messages.exception.getString("sendEmail.insertDestinationEmail"));
            return;
        }
        if (this.connector instanceof HttpConnectorBaseWithForwarding) {
            HttpConnectorBaseWithForwarding connectorWithForwarding = (HttpConnectorBaseWithForwarding) this.connector;
            connectorWithForwarding.startForwarding(jTextFieldDestino.getText(), mensagensParaReenviar, ((Integer) jSpinnerTempoEntreReenvios.getValue()).intValue());
        }
        * 
        */
    }//GEN-LAST:event_jButtonReenviarActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButtonCancelarReenvio;
    private javax.swing.JButton jButtonReenviar;
    private javax.swing.JLabel jLabelDestino;
    private javax.swing.JLabel jLabelTempo;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JSpinner jSpinnerTempoEntreReenvios;
    private javax.swing.JTextField jTextFieldDestino;
    // End of variables declaration//GEN-END:variables
}
